package net.mimai.vultrue.bus.enums;

import net.mimai.vultrue.framework.utils.JudgeUtils;


/**
 *  通用状态，有特殊状态要求的，需要自行另行定义，不使用此类
 */
public enum SimpleStatus {
    UN_USE(0,"未启用"),
    NORMAL(1,"正常"),
    DISABLED(2,"禁用"),


    ;
    int key;
    String desc;

    SimpleStatus(int key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public int getKey() {
        return key;
    }

    public void setKey(int key) {
        this.key = key;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static Boolean isMember(int key){
        SimpleStatus[] vs= SimpleStatus.values();
        for(SimpleStatus h:vs){
            if(JudgeUtils.equals(key,h.getKey())){
                return true;
            }
        }
        return false;
    }

    public static SimpleStatus getByKey(int key){
        SimpleStatus[] vs= SimpleStatus.values();
        for(SimpleStatus h:vs){
            if(JudgeUtils.equals(key,h.getKey())){
                return h;
            }
        }
        return null;
    }
}
